package com.twang.stock.controller.common;

import com.google.common.collect.Lists;
import com.twang.stock.service.KaiPanLaService;
import com.twang.stock.task.QueryZhangDieTingTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

@Controller
@RequestMapping(value = "/zhangdie")
@Slf4j
public class BigDataController {


    @Autowired
    private KaiPanLaService kaiPanLaService;

    /**
     * 涨停高度版
     * @return
     */
    @RequestMapping(value = "/query")
    public ModelAndView gaodu() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("kaiPanLaZhangTingInfoSeriesList", kaiPanLaService.获取连扳信息());
        modelAndView.setViewName("bigdata/index");
        return modelAndView;
    }



    /**
     * 涨停高度版
     * @return
     */
    @RequestMapping(value = "/hotStock")
    public ModelAndView hotStock() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("kaiPanLaZhangTingInfoSeriesList", kaiPanLaService.获取连扳信息());
        modelAndView.setViewName("duanxian/daChengJiaoe");
        return modelAndView;
    }

    /**
     * 实时龙虎榜
     * @return
     */
    @RequestMapping(value = "/sslhb")
    public ModelAndView shiShiLongHuBang(String startDate,String endDate) {
        ModelAndView modelAndView = new ModelAndView();
        List<String> times = Lists.newArrayList();
        StringBuffer stringBuffer=new StringBuffer("T1000");
        List<BigDecimal> T1000 = kaiPanLaService.getKaiPanLaShiShiLongHuBang(stringBuffer,"0925", "1000");
        times.add(stringBuffer.toString());
        modelAndView.addObject("kaiPanLa_T1000", T1000);

        stringBuffer=new StringBuffer("T1030");
        List<BigDecimal> T1030 = kaiPanLaService.getKaiPanLaShiShiLongHuBang(stringBuffer,"1000", "1030");
        times.add(stringBuffer.toString());
        modelAndView.addObject("kaiPanLa_T1030", T1030);

        stringBuffer=new StringBuffer("T1100");
        List<BigDecimal> T1100 = kaiPanLaService.getKaiPanLaShiShiLongHuBang(stringBuffer,"1030", "1100");
        times.add(stringBuffer.toString());
        modelAndView.addObject("kaiPanLa_T1100", T1100);

        stringBuffer=new StringBuffer("T1130");
        List<BigDecimal> T1130 = kaiPanLaService.getKaiPanLaShiShiLongHuBang(stringBuffer,"1100", "1130");
        times.add(stringBuffer.toString());
        modelAndView.addObject("kaiPanLa_T1130", T1130);

        stringBuffer=new StringBuffer("T1330");
        List<BigDecimal> T1330 = kaiPanLaService.getKaiPanLaShiShiLongHuBang(stringBuffer,"1130", "1330");
        times.add(stringBuffer.toString());
        modelAndView.addObject("kaiPanLa_T1330", T1330);

        stringBuffer=new StringBuffer("T1400");
        List<BigDecimal> T1400 = kaiPanLaService.getKaiPanLaShiShiLongHuBang(stringBuffer,"1330", "1400");
        times.add(stringBuffer.toString());
        modelAndView.addObject("kaiPanLa_T1400", T1400);

        stringBuffer=new StringBuffer("T1430");
        List<BigDecimal> T1430 = kaiPanLaService.getKaiPanLaShiShiLongHuBang(stringBuffer,"1400", "1430");
        times.add(stringBuffer.toString());
        modelAndView.addObject("kaiPanLa_T1430", T1430);

        stringBuffer=new StringBuffer("T1500");
        List<BigDecimal> T1500 = kaiPanLaService.getKaiPanLaShiShiLongHuBang(stringBuffer,"1430", "1500");
        times.add(stringBuffer.toString());
        modelAndView.addObject("kaiPanLa_T1500", T1500);

        modelAndView.addObject("kaiPanLa_times", times);
        modelAndView.setViewName("bigdata/shishi_longhubang");
        return modelAndView;
    }
}
